]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
lookingGlass: Sort extensions alphabetically
authorFlorijan Hamzic <fh@infinicode.de>
Thu, 3 Dec 2020 22:36:33 +0000 (23:36 +0100)
committerMarge Bot <marge-bot@gnome.org>
Fri, 4 Dec 2020 02:29:44 +0000 (02:29 +0000)
Extensions are currently listed in random order, which is hardly
user-friendly. Instead, sort them alphabetically to make the list
easier to parse.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1516>

js/ui/lookingGlass.js

index 147e46b2eb94e4b821409df9963ae4ba524212f1..109c04631fd38f98bd6f20fd909406f8cd8abd92 100644 (file)
@@ -687,7 +687,10 @@ var Extensions = GObject.registerClass({
             this._extensionsList.remove_actor(this._noExtensions);
 
         this._numExtensions++;
-        this._extensionsList.add(extensionDisplay);
+        const { name } = extension.metadata;
+        const pos = [...this._extensionsList].findIndex(
+            dsp => dsp._extension.metadata.name.localeCompare(name) > 0);
+        this._extensionsList.insert_child_at_index(extensionDisplay, pos);
     }
 
     _onViewSource(actor) {
@@ -750,6 +753,7 @@ var Extensions = GObject.registerClass({
 
     _createExtensionDisplay(extension) {
         let box = new St.BoxLayout({ style_class: 'lg-extension', vertical: true });
+        box._extension = extension;
         let name = new St.Label({
             style_class: 'lg-extension-name',
             text: extension.metadata.name,